package br.com.minhasfinancas.web.bean;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.minhasfinancas.api.manager.UsuarioManager;
import br.com.minhasfinancas.api.model.Usuario;
import br.com.minhasfinancas.fw.bean.AbstractManagedBean;
import br.com.minhasfinancas.fw.util.JSFUtil;

@ManagedBean
@ViewScoped
public class UsuarioBean extends AbstractManagedBean<Usuario, Long, UsuarioManager> {
	private static final long serialVersionUID = 1L;
	
	private String confirmSenha;

	@Override
	public String getEditView() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getListView() {
		return "/login.xhtml?faces-redirect=true";
	}
	
	@Override
	public List<Usuario> handleResultList() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public String persist() {
		String retorno = null;
		if (!this.getInstance().getSenha().equals(this.confirmSenha)) {
			JSFUtil.sendWarnMessageToUser("MSG032");
		}else{
			super.persist();
		}
		return retorno;
	}

	public String getConfirmSenha() {
		return confirmSenha;
	}

	public void setConfirmSenha(String confirmSenha) {
		this.confirmSenha = confirmSenha;
	}
	
	

}
